import 'package:flutter/material.dart';
import 'package:gd_assistant/main.dart';
import 'package:gd_assistant/page/me/changePassWordPage.dart';
import 'package:gd_assistant/page/public/colors.dart';
import 'package:gd_assistant/page/public/themeUtils.dart';
import 'package:gd_assistant/util/customRoute.dart';
import 'package:gd_assistant/util/dataUtil.dart';

class settingPage extends StatefulWidget {
  @override
  _settingPageState createState() => _settingPageState();
}

class _settingPageState extends State<settingPage> {
  bool isDark = false;
  @override
  Widget build(BuildContext context) {
    isDark = ThemeUtils.isDark(context);
    Color bg_color = isDark ? Colours.dark_bg_gray : Colors.white;
    return Scaffold(
      backgroundColor: isDark ? Colours.dark_bg_color : Colours.bg_color,
      appBar: AppBar(
        title: Text("设置"),
      ),
      body: Container(
        child: ListView(
          children: <Widget>[
            Padding(
              padding: EdgeInsets.only(top: 20),
              child: GestureDetector(
                onTap: (){
                   Navigator.of(context).push(
                    CustomRoute(changePassWordPage())
                  ); 
                },
                child: Container(
                  height: 60,
                  color: bg_color,
                  child: Padding(
                    padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
                    child:  Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        Text("修改密码", style: TextStyle(fontSize: 18)),
                        Icon(Icons.arrow_forward_ios, size: 15, color: Colors.grey),
                      ],
                    ),
                  )
                ),
              )
            ),
            Padding(
              padding: EdgeInsets.only(top: 20),
              child:  GestureDetector(
                onTap: (){
                  //跳转到登录页
                  dataUtil.removeAll();
                  Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) {
                    return LoginApp();
                  },fullscreenDialog: true), (route) => false);
                },
                child: Container(
                  height: 60,
                  color: bg_color,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      Text("退出登录", style: TextStyle(fontSize: 18, color: Colors.red)),
                    ],
                  ),
                ),
              )
            )
          ],
        ),
      ),
    );
  }
}